package net.protocols;

import net.dto.ClientObject;
import net.dto.ServerObject;

public class ServerProtocol {
	
	private static final int INITIALIZE = 0;
	private static final int WAITING = 1;
	private static final int PLAYING = 2;
	private int CURRENT_STATE = 0;
	private int client_id;
	
	public ServerProtocol(int id){
		this.client_id = id;
	}
	
	public ServerObject processInput(ClientObject io){
		String input;
		if( io != null)
			input = io.getMessage(); 
	
		if(CURRENT_STATE == INITIALIZE){
			CURRENT_STATE = WAITING;
			return new ServerObject(String.valueOf(client_id),"");
		}if(CURRENT_STATE == WAITING){
			return new ServerObject("Waiting for other players...","");
		}
		
		return null;
	}
	
	public void setState(int i){
		CURRENT_STATE = i;
	}
	
}
